import { request } from '@/utils/request'

let url = 'http://localhost:5177'

// 用户相关API（调整接口路径以匹配个人设置界面的调用）
export const userAPI = {
  // 获取用户列表
  getUserList: (params) => request('get', `${url}/api/user`, null, {
    PageIndex: params.pageIndex,
    PageSize: params.pageSize,
    Keyword: params.keyword || undefined
  }),

  // 搜索用户
  getUserByName: (data) => request('get', `${url}/api/user/search/username/${data}`),

  // 创建用户
  createUser: (data) => request('post', `${url}/api/user/create`, data),

  // 更新用户
  updateUser: (id, data) => request('put', `${url}/api/user/update/${id}`, data),

  // 删除用户
  deleteUser: (id) => request('delete', `${url}/api/user/delete/${id}`),

  // 重置密码
  resetPassword: (id, data) => request('post', `${url}/api/user/${id}/reset-password`, data),

  // 启用用户
  enableUser: (id) => request('post', `${url}/api/user/enable/${id}`),
}